package com.lihua.project.system.comment.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lihua.project.system.comment.mapper.CommentMapper;
import com.lihua.project.system.comment.domain.Comment;
import com.lihua.project.system.comment.service.ICommentService;
import com.lihua.common.utils.text.Convert;

/**
 * 文章评论Service业务层处理
 * 
 * @author lihua
 * @date 2022-04-06
 */
@Service
public class CommentServiceImpl implements ICommentService 
{
    @Autowired
    private CommentMapper commentMapper;

    /**
     * 查询文章评论
     * 
     * @param id 文章评论主键
     * @return 文章评论
     */
    @Override
    public Comment selectCommentById(Long id)
    {
        return commentMapper.selectCommentById(id);
    }

    /**
     * 查询文章评论列表
     * 
     * @param comment 文章评论
     * @return 文章评论
     */
    @Override
    public List<Comment> selectCommentList(Comment comment)
    {
        return commentMapper.selectCommentList(comment);
    }

    /**
     * 新增文章评论
     * 
     * @param comment 文章评论
     * @return 结果
     */
    @Override
    public int insertComment(Comment comment)
    {
        comment.setCommentTime(new Date());
        return commentMapper.insertComment(comment);
    }

    /**
     * 修改文章评论
     * 
     * @param comment 文章评论
     * @return 结果
     */
    @Override
    public int updateComment(Comment comment)
    {
        return commentMapper.updateComment(comment);
    }

    /**
     * 批量删除文章评论
     * 
     * @param ids 需要删除的文章评论主键
     * @return 结果
     */
    @Override
    public int deleteCommentByIds(String ids)
    {
        return commentMapper.deleteCommentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除文章评论信息
     * 
     * @param id 文章评论主键
     * @return 结果
     */
    @Override
    public int deleteCommentById(Long id)
    {
        return commentMapper.deleteCommentById(id);
    }
}
